package edu.TestIO;

import java.io.File;

public class Test01 {//遍历
    public static void main(String[] args) {
        File f = new File("D:/untitled");
        if (f.exists()){
            f.delete();
        }f.mkdirs();
        bianli(f,1);

    }
    //遍历
    public static void bianli(File f,int level){
        File[] files = f.listFiles();
        for (File fs: files ) {
            for (int i = 0; i <=level-1 ;i++) {
                System.out.print("-");
            }
            System.out.println(fs.getName()+fs.length());
            if (fs.isDirectory()){
                bianli(fs,level+1);
            }
        }
    }
}
